﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace Filmek
{
    public partial class RegisterForm : Form
    {
        private MyReader reader;
        public RegisterForm()
        {
            InitializeComponent();
        }

        public bool validateInput(){
            if(nevTextBox.Text== "" || jelszoTextBox1.Text == "" || jelszoTextBox1.Text == "")
                return false;
            if (jelszoTextBox1.Text != jelszoTextBox2.Text)
                return false;
            return true;
                    
        }


        private void okButton_Click(object sender, EventArgs e)
        {
            bool err = true;
            reader = new MyReader(ref err);
            if (validateInput())
            {
                if (reader.Register(nevTextBox.Text.ToString(), jelszoTextBox1.Text.ToString()))
                {
                    MessageBox.Show("sikeres regisztarcio");
                    this.Close();
                }
                else
                    MessageBox.Show("letezik mar ilyen felhasznalo");
            }
            else
            {
                MessageBox.Show("hibas adatok");
            }
        }
    }
}
